/**
 * Copyright 2011 ArcBees Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package vn.nichecafe.client.gin;

import vn.nichecafe.client.CurrentUser;
import vn.nichecafe.client.IsAdminGatekeeper;
import vn.nichecafe.client.MyConstants;
import vn.nichecafe.client.NICHECafePlaceManager;
import vn.nichecafe.client.NameTokens;
import vn.nichecafe.client.presenter.AboutNicheBandPresenter;
import vn.nichecafe.client.presenter.AboutNicheCafePresenter;
import vn.nichecafe.client.presenter.AboutPresenter;
import vn.nichecafe.client.presenter.AdminPresenter;
import vn.nichecafe.client.presenter.ContactUsPresenter;
import vn.nichecafe.client.presenter.FeaturedLiveMusicSubTabPresenter;
import vn.nichecafe.client.presenter.FeaturedPresenter;
import vn.nichecafe.client.presenter.FeaturedTakeAwaySubTabPresenter;
import vn.nichecafe.client.presenter.GlobalDialogPresenterWidget;
import vn.nichecafe.client.presenter.InfoPopupPresenterWidget;
import vn.nichecafe.client.presenter.LocalDialogPresenterWidget;
import vn.nichecafe.client.presenter.LoginPresenter;
import vn.nichecafe.client.presenter.MainPagePresenter;
import vn.nichecafe.client.presenter.MyNichePresenter;
import vn.nichecafe.client.presenter.NewsEventsSubTabPresenter;
import vn.nichecafe.client.presenter.NewsNewsSubTabPresenter;
import vn.nichecafe.client.presenter.NewsPresenter;
import vn.nichecafe.client.presenter.WelcomePresenter;
import vn.nichecafe.client.view.AboutNicheBandView;
import vn.nichecafe.client.view.AboutNicheCafeView;
import vn.nichecafe.client.view.AboutView;
import vn.nichecafe.client.view.AdminView;
import vn.nichecafe.client.view.ContactUsView;
import vn.nichecafe.client.view.FeaturedLiveMusicSubTabView;
import vn.nichecafe.client.view.FeaturedTakeAwaySubTabView;
import vn.nichecafe.client.view.FeaturedView;
import vn.nichecafe.client.view.GlobalDialogView;
import vn.nichecafe.client.view.InfoPopupView;
import vn.nichecafe.client.view.LocalDialogView;
import vn.nichecafe.client.view.LoginView;
import vn.nichecafe.client.view.MainPageView;
import vn.nichecafe.client.view.MyNicheView;
import vn.nichecafe.client.view.NewsEventsSubTabView;
import vn.nichecafe.client.view.NewsNewsSubTabView;
import vn.nichecafe.client.view.NewsView;
import vn.nichecafe.client.view.WelcomeView;

import com.google.inject.Singleton;
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
import com.gwtplatform.mvp.client.gin.DefaultModule;

/**
 * @author Christian Goudreau
 */
public class ClientModule extends AbstractPresenterModule {
	@Override
	protected void configure() {
		// Default implementation of standard resources
		install(new DefaultModule(NICHECafePlaceManager.class));

		bind(MyConstants.class).in(Singleton.class);
		bind(CurrentUser.class).in(Singleton.class);
		bind(IsAdminGatekeeper.class).in(Singleton.class);

		// Constants
		bindConstant().annotatedWith(DefaultPlace.class).to(
				NameTokens.welcomePage);

		// Presenters
		bindPresenter(MainPagePresenter.class, MainPagePresenter.MyView.class,
				MainPageView.class, MainPagePresenter.MyProxy.class);
		bindPresenter(AboutPresenter.class, AboutPresenter.MyView.class,
				AboutView.class, AboutPresenter.MyProxy.class);
		
		bindPresenter(NewsNewsSubTabPresenter.class,
				NewsNewsSubTabPresenter.MyView.class,
				NewsNewsSubTabView.class,
				NewsNewsSubTabPresenter.MyProxy.class);
		bindPresenter(NewsEventsSubTabPresenter.class,
				NewsEventsSubTabPresenter.MyView.class,
				NewsEventsSubTabView.class,
				NewsEventsSubTabPresenter.MyProxy.class);
		bindPresenter(LoginPresenter.class, LoginPresenter.MyView.class,
				LoginView.class, LoginPresenter.MyProxy.class);
		bindPresenter(AdminPresenter.class,
				AdminPresenter.MyView.class, AdminView.class,
				AdminPresenter.MyProxy.class);
		bindPresenter(ContactUsPresenter.class,
				ContactUsPresenter.MyView.class, ContactUsView.class,
				ContactUsPresenter.MyProxy.class);
		bindPresenter(MyNichePresenter.class,
				MyNichePresenter.MyView.class, MyNicheView.class,
				MyNichePresenter.MyProxy.class);
		bindPresenter(AboutNicheBandPresenter.class,
				AboutNicheBandPresenter.MyView.class, AboutNicheBandView.class,
				AboutNicheBandPresenter.MyProxy.class);
		bindPresenter(AboutNicheCafePresenter.class,
				AboutNicheCafePresenter.MyView.class, AboutNicheCafeView.class,
				AboutNicheCafePresenter.MyProxy.class);
		bindPresenter(WelcomePresenter.class, WelcomePresenter.MyView.class,
				WelcomeView.class, WelcomePresenter.MyProxy.class);
		bindPresenter(NewsPresenter.class, NewsPresenter.MyView.class,
				NewsView.class, NewsPresenter.MyProxy.class);

		bindPresenter(FeaturedPresenter.class, FeaturedPresenter.MyView.class,
				FeaturedView.class, FeaturedPresenter.MyProxy.class);
		
		bindPresenter(FeaturedLiveMusicSubTabPresenter.class,
				FeaturedLiveMusicSubTabPresenter.MyView.class,
				FeaturedLiveMusicSubTabView.class,
				FeaturedLiveMusicSubTabPresenter.MyProxy.class);
		
		bindPresenter(FeaturedTakeAwaySubTabPresenter.class,
				FeaturedTakeAwaySubTabPresenter.MyView.class,
				FeaturedTakeAwaySubTabView.class,
				FeaturedTakeAwaySubTabPresenter.MyProxy.class);

		// Presenter Widgets
		bindSingletonPresenterWidget(InfoPopupPresenterWidget.class,
				InfoPopupPresenterWidget.MyView.class, InfoPopupView.class);
		bindSingletonPresenterWidget(LocalDialogPresenterWidget.class,
				LocalDialogPresenterWidget.MyView.class, LocalDialogView.class);
		bindSingletonPresenterWidget(GlobalDialogPresenterWidget.class,
				GlobalDialogPresenterWidget.MyView.class,
				GlobalDialogView.class);
	}
}